From 152326bd24432e0e56aaaf6aa769025ea9b2de54 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 15 Dec 2015 21:06:53 -0500 Subject: [PATCH] paned: Allocate the handle input area properly Drop the margin misuse and use the border allocation of the handle gadget. We use negative margins to make the border allocation larger without pushing the paned children out. --- gtk/gtkpaned.c | 27 +++----------- gtk/theme/Adwaita/_common.scss | 21 ++++++----- gtk/theme/Adwaita/gtk-contained-dark.css | 45 +++++++++++++----------- gtk/theme/Adwaita/gtk-contained.css | 45 +++++++++++++----------- 4 files changed, 66 insertions(+), 72 deletions(-) diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c index 7a5940ef36..4aa918420f 100644 --- a/gtk/gtkpaned.c +++ b/gtk/gtkpaned.c @@ -1498,32 +1498,15 @@ gtk_paned_allocate (GtkCssGadget *gadget, if (gtk_widget_get_realized (widget)) { - GtkBorder margin; - GtkStyleContext *context = gtk_widget_get_style_context (widget); - - gtk_style_context_get_margin (context, - gtk_style_context_get_state (context), - &margin); + GtkAllocation border_alloc; if (gtk_widget_get_mapped (widget)) gdk_window_show (priv->handle); - if (priv->orientation == GTK_ORIENTATION_HORIZONTAL) - { - gdk_window_move_resize (priv->handle, - priv->handle_pos.x - margin.left, - priv->handle_pos.y, - handle_size + margin.left + margin.right, - priv->handle_pos.height); - } - else - { - gdk_window_move_resize (priv->handle, - priv->handle_pos.x, - priv->handle_pos.y - margin.top, - priv->handle_pos.width, - handle_size + margin.top + margin.bottom); - } + gtk_css_gadget_get_border_allocation (priv->handle_gadget, &border_alloc, NULL); + gdk_window_move_resize (priv->handle, + border_alloc.x, border_alloc.y, + border_alloc.width, border_alloc.height); } /* Now allocate the childen, making sure, when resizing not to diff --git a/gtk/theme/Adwaita/_common.scss b/gtk/theme/Adwaita/_common.scss index e8b1e84bba..94fadadd31 100644 --- a/gtk/theme/Adwaita/_common.scss +++ b/gtk/theme/Adwaita/_common.scss @@ -2948,14 +2948,7 @@ placesview { * Paned * *********/ -paned { // this is for the standard paned separator - - -gtk-icon-source: none; // removes handle decoration - margin: 0 8px 8px 0; // drag area of the separator, not a real margin - &:dir(rtl) { - margin-right: 0; - margin-left: 8px; - } +paned { separator { min-width: 1px; min-height: 1px; @@ -2964,6 +2957,18 @@ paned { // this is for the standard paned separator background-color: $backdrop_borders_color; } } + &:dir(ltr).horizontal separator { + margin: 0 -8px 0 0; + padding: 0 8px 0 0; + } + &:dir(rtl).horizontal separator { + margin: 0 0 0 -8px; + padding: 0 0 0 8px; + } + &.vertical separator { + margin: 0 0 -8px 0; + padding: 0 0 8px 0; + } separator:selected { background-color: $selected_bg_color; } diff --git a/gtk/theme/Adwaita/gtk-contained-dark.css b/gtk/theme/Adwaita/gtk-contained-dark.css index 4a056fa00a..840f19e118 100644 --- a/gtk/theme/Adwaita/gtk-contained-dark.css +++ b/gtk/theme/Adwaita/gtk-contained-dark.css @@ -4111,27 +4111,30 @@ placesview row.activatable:hover { /********* * Paned * *********/ -paned { - -gtk-icon-source: none; - margin: 0 8px 8px 0; } - paned:dir(rtl) { - margin-right: 0; - margin-left: 8px; } - paned separator { - min-width: 1px; - min-height: 1px; - background-color: #1c1f1f; } - paned separator:backdrop { - background-color: #1f2222; } - paned separator:selected { - background-color: #215d9c; } - paned separator.wide { - min-width: 5px; - min-height: 5px; - background-color: transparent; - border-style: none solid; - border-color: #1c1f1f; - border-width: 1px; } +paned separator { + min-width: 1px; + min-height: 1px; + background-color: #1c1f1f; } + paned separator:backdrop { + background-color: #1f2222; } +paned:dir(ltr).horizontal separator { + margin: 0 -8px 0 0; + padding: 0 8px 0 0; } +paned:dir(rtl).horizontal separator { + margin: 0 0 0 -8px; + padding: 0 0 0 8px; } +paned.vertical separator { + margin: 0 0 -8px 0; + padding: 0 0 8px 0; } +paned separator:selected { + background-color: #215d9c; } +paned separator.wide { + min-width: 5px; + min-height: 5px; + background-color: transparent; + border-style: none solid; + border-color: #1c1f1f; + border-width: 1px; } /************** * GtkInfoBar * diff --git a/gtk/theme/Adwaita/gtk-contained.css b/gtk/theme/Adwaita/gtk-contained.css index 493aeb7d52..d50b5d9aa9 100644 --- a/gtk/theme/Adwaita/gtk-contained.css +++ b/gtk/theme/Adwaita/gtk-contained.css @@ -4283,27 +4283,30 @@ placesview row.activatable:hover { /********* * Paned * *********/ -paned { - -gtk-icon-source: none; - margin: 0 8px 8px 0; } - paned:dir(rtl) { - margin-right: 0; - margin-left: 8px; } - paned separator { - min-width: 1px; - min-height: 1px; - background-color: #9d9d99; } - paned separator:backdrop { - background-color: #a5a5a1; } - paned separator:selected { - background-color: #4a90d9; } - paned separator.wide { - min-width: 5px; - min-height: 5px; - background-color: transparent; - border-style: none solid; - border-color: #9d9d99; - border-width: 1px; } +paned separator { + min-width: 1px; + min-height: 1px; + background-color: #9d9d99; } + paned separator:backdrop { + background-color: #a5a5a1; } +paned:dir(ltr).horizontal separator { + margin: 0 -8px 0 0; + padding: 0 8px 0 0; } +paned:dir(rtl).horizontal separator { + margin: 0 0 0 -8px; + padding: 0 0 0 8px; } +paned.vertical separator { + margin: 0 0 -8px 0; + padding: 0 0 8px 0; } +paned separator:selected { + background-color: #4a90d9; } +paned separator.wide { + min-width: 5px; + min-height: 5px; + background-color: transparent; + border-style: none solid; + border-color: #9d9d99; + border-width: 1px; } /************** * GtkInfoBar * -- 2.30.2